home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / CIncludes / QD3DRenderer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-17  |  42.5 KB  |  1,277 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DRenderer.h
  3.  
  4.      Contains:    Q3Renderer types and routines                                          
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DRENDERER__
  19. #define __QD3DRENDERER__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24. #ifndef __QD3DSET__
  25. #include <QD3DSet.h>
  26. #endif
  27. #ifndef __QD3DVIEW__
  28. #include <QD3DView.h>
  29. #endif
  30.  
  31. #if TARGET_OS_MAC
  32. #ifndef __EVENTS__
  33. #include <Events.h>
  34. #endif
  35. #endif  /* TARGET_OS_MAC */
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=power
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. #if PRAGMA_ENUM_ALWAYSINT
  60.     #pragma enumsalwaysint on
  61. #elif PRAGMA_ENUM_OPTIONS
  62.     #pragma option enum=int
  63. #elif PRAGMA_ENUM_PACK
  64.     #if __option(pack_enums)
  65.         #define PRAGMA_ENUM_PACK__QD3DRENDERER__
  66.     #endif
  67.     #pragma options(!pack_enums)
  68. #endif
  69.  
  70. /******************************************************************************
  71.  **                                                                             **
  72.  **                            User Interface Things                             **
  73.  **                                                                             **
  74.  *****************************************************************************/
  75. #if TARGET_OS_MAC
  76. /*
  77.  *  A callback to an application's event handling code. This is needed to    
  78.  *  support movable modal dialogs. The dialog's event filter calls this      
  79.  *  callback with events it does not handle.                                 
  80.  *  If an application handles the event it should return kQ3True.            
  81.  *  If the application does not handle the event it must return kQ3False and 
  82.  *  the dialog's event filter will pass the event to the system unhandled.   
  83.  */
  84. typedef CALLBACK_API_C( TQ3Boolean , TQ3MacOSDialogEventHandler )(const EventRecord *event);
  85.  
  86. struct TQ3DialogAnchor {
  87.     TQ3MacOSDialogEventHandler         clientEventHandler;
  88. };
  89. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  90. #endif  /* TARGET_OS_MAC */
  91.  
  92. #if TARGET_OS_WIN32
  93.  
  94. struct TQ3DialogAnchor {
  95.     HWND                             ownerWindow;
  96. };
  97. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  98. #endif  /* TARGET_OS_WIN32 */
  99.  
  100. #if TARGET_OS_UNIX
  101.  
  102. struct TQ3DialogAnchor {
  103.     void *                            notUsed;                    /* place holder */
  104. };
  105. typedef struct TQ3DialogAnchor            TQ3DialogAnchor;
  106. #endif  /* TARGET_OS_UNIX */
  107.  
  108. /******************************************************************************
  109.  **                                                                             **
  110.  **                            Renderer Functions                                 **
  111.  **                                                                             **
  112.  *****************************************************************************/
  113. EXTERN_API_C( TQ3RendererObject )
  114. Q3Renderer_NewFromType            (TQ3ObjectType             rendererObjectType);
  115.  
  116. EXTERN_API_C( TQ3ObjectType )
  117. Q3Renderer_GetType                (TQ3RendererObject         renderer);
  118.  
  119.  
  120. /* Q3Renderer_Flush has been replaced by Q3View_Flush */
  121. /* Q3Renderer_Sync has been replaced by Q3View_Sync */
  122.  
  123. /*
  124.  *    Q3Renderer_IsInteractive
  125.  *        Determine if this renderer is intended to be used interactively.
  126.  */
  127. EXTERN_API_C( TQ3Boolean )
  128. Q3Renderer_IsInteractive        (TQ3RendererObject         renderer);
  129.  
  130.  
  131. /*
  132.  *    Q3Renderer_HasModalConfigure
  133.  *        Determine if this renderer has a modal settings dialog.
  134.  *
  135.  *    Q3Renderer_ModalConfigure
  136.  *        Have the renderer pop up a modal dialog box to configure its settings.
  137.  *    dialogAnchor - is platform specific data passed by the client to support
  138.  *      movable modal dialogs. 
  139.  *    MacOS: this is a callback to the calling application's event handler.
  140.  *      The renderer calls this function with events not handled by the 
  141.  *      settings dialog. This is necessary in order to support movable modal 
  142.  *      dialogs. An application's event handler must return kQ3True if it 
  143.  *      handles the event passed to the callback or kQ3False if not. 
  144.  *      An application which doesn't want to support a movable modal configure
  145.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  146.  *    Win32: this is the HWND of the owning window (typically an application's
  147.  *      main window).
  148.  *  canceled - returns a boolean inditacating that the user canceled the 
  149.  *    dialog.
  150.  *      
  151.  */
  152. EXTERN_API_C( TQ3Boolean )
  153. Q3Renderer_HasModalConfigure    (TQ3RendererObject         renderer);
  154.  
  155. EXTERN_API_C( TQ3Status )
  156. Q3Renderer_ModalConfigure        (TQ3RendererObject         renderer,
  157.                                  TQ3DialogAnchor         dialogAnchor,
  158.                                  TQ3Boolean *            canceled);
  159.  
  160. /*
  161.  *    Q3RendererClass_GetNickNameString
  162.  *        Allows an application to get a renderers name string, the 
  163.  *        renderer is responsible for storing this in a localizable format
  164.  *        for example as a resource.  This string can then be used to provide
  165.  *        a selection mechanism for an application (for example in a menu).
  166.  *
  167.  *        If this call returns nil in the supplied string, then the App may 
  168.  *         choose to use the class name for the renderer.  You should always 
  169.  *        try to get the name string before using the class name, since the
  170.  *        class name is not localizable.
  171.  */
  172. EXTERN_API_C( TQ3Status )
  173. Q3RendererClass_GetNickNameString (TQ3ObjectType         rendererClassType,
  174.                                  TQ3ObjectClassNameString  rendererClassString);
  175.  
  176.  
  177. /*
  178.  *    Q3Renderer_GetConfigurationData
  179.  *        Allows an application to collect private renderer configuration data
  180.  *      which it will then save. For example in a preference file or in a 
  181.  *        style template. An application should tag this data with the 
  182.  *        Renderer's object  name.
  183.  *    
  184.  *        if dataBuffer is NULL actualDataSize returns the required size in 
  185.  *        bytes of a data buffer large enough to store private data. 
  186.  *
  187.  *      bufferSize is the actual size of the memory block pointed to by 
  188.  *        dataBuffer
  189.  *
  190.  *        actualDataSize - on return the actual number of bytes written to the 
  191.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  192.  * 
  193.  */
  194. EXTERN_API_C( TQ3Status )
  195. Q3Renderer_GetConfigurationData    (TQ3RendererObject         renderer,
  196.                                  unsigned char *        dataBuffer,
  197.                                  unsigned long             bufferSize,
  198.                                  unsigned long *        actualDataSize);
  199.  
  200. EXTERN_API_C( TQ3Status )
  201. Q3Renderer_SetConfigurationData    (TQ3RendererObject         renderer,
  202.                                  unsigned char *        dataBuffer,
  203.                                  unsigned long             bufferSize);
  204.  
  205.  
  206.  
  207. /******************************************************************************
  208.  **                                                                             **
  209.  **                        Interactive Renderer Specific Functions                 **
  210.  **                                                                             **
  211.  *****************************************************************************/
  212. /* CSG IDs attribute */
  213. #define kQ3AttributeTypeConstructiveSolidGeometryID        Q3_OBJECT_TYPE('c','s','g','i')
  214. /* Object IDs, to be applied as attributes on geometries */
  215. #define kQ3SolidGeometryObjNone (-1)
  216. #define kQ3SolidGeometryObjA     0
  217. #define kQ3SolidGeometryObjB     1
  218. #define kQ3SolidGeometryObjC     2
  219. #define kQ3SolidGeometryObjD     3
  220. #define kQ3SolidGeometryObjE     4
  221. /* Possible CSG equations */
  222.  
  223. enum TQ3CSGEquation {
  224.     kQ3CSGEquationAandB            = (long)0x88888888,
  225.     kQ3CSGEquationAandnotB        = 0x22222222,
  226.     kQ3CSGEquationAanBonCad        = 0x2F222F22,
  227.     kQ3CSGEquationnotAandB        = 0x44444444,
  228.     kQ3CSGEquationnAaBorCanB    = 0x74747474
  229. };
  230. typedef enum TQ3CSGEquation TQ3CSGEquation;
  231.  
  232.  
  233. enum TQ3HiddenSurfaceRemovalMode {
  234.     kQ3HiddenSurfaceRemovalMode_None = 0,
  235.     kQ3HiddenSurfaceRemovalMode_Shallow = 1,
  236.     kQ3HiddenSurfaceRemovalMode_Deep = 2
  237. };
  238. typedef enum TQ3HiddenSurfaceRemovalMode TQ3HiddenSurfaceRemovalMode;
  239.  
  240. EXTERN_API_C( TQ3Status )
  241. Q3InteractiveRenderer_SetCSGEquation (TQ3RendererObject  renderer,
  242.                                  TQ3CSGEquation         equation);
  243.  
  244. EXTERN_API_C( TQ3Status )
  245. Q3InteractiveRenderer_GetCSGEquation (TQ3RendererObject  renderer,
  246.                                  TQ3CSGEquation *        equation);
  247.  
  248. EXTERN_API_C( TQ3Status )
  249. Q3InteractiveRenderer_SetPreferences (TQ3RendererObject  renderer,
  250.                                  long                     vendorID,
  251.                                  long                     engineID);
  252.  
  253. EXTERN_API_C( TQ3Status )
  254. Q3InteractiveRenderer_GetPreferences (TQ3RendererObject  renderer,
  255.                                  long *                    vendorID,
  256.                                  long *                    engineID);
  257.  
  258. EXTERN_API_C( TQ3Status )
  259. Q3InteractiveRenderer_SetDoubleBufferBypass (TQ3RendererObject  renderer,
  260.                                  TQ3Boolean             bypass);
  261.  
  262. EXTERN_API_C( TQ3Status )
  263. Q3InteractiveRenderer_GetDoubleBufferBypass (TQ3RendererObject  renderer,
  264.                                  TQ3Boolean *            bypass);
  265.  
  266. EXTERN_API_C( TQ3Status )
  267. Q3InteractiveRenderer_SetRAVEContextHints (TQ3RendererObject  renderer,
  268.                                  unsigned long             RAVEContextHints);
  269.  
  270. EXTERN_API_C( TQ3Status )
  271. Q3InteractiveRenderer_GetRAVEContextHints (TQ3RendererObject  renderer,
  272.                                  unsigned long *        RAVEContextHints);
  273.  
  274. EXTERN_API_C( TQ3Status )
  275. Q3InteractiveRenderer_SetRAVETextureFilter (TQ3RendererObject  renderer,
  276.                                  unsigned long             RAVEtextureFilterValue);
  277.  
  278. EXTERN_API_C( TQ3Status )
  279. Q3InteractiveRenderer_GetRAVETextureFilter (TQ3RendererObject  renderer,
  280.                                  unsigned long *        RAVEtextureFilterValue);
  281.  
  282.  
  283. /******************************************************************************
  284.  **                                                                             **
  285.  **                            Renderer View Tools                                 **
  286.  **                                                                             **
  287.  **                    You may only call these methods from a plug-in             **
  288.  **                                                                             **
  289.  *****************************************************************************/
  290. /*
  291.  *    Call by a renderer to call the user "idle" method, with progress 
  292.  *    information.
  293.  *    
  294.  *    Pass in (view, 0, n) on first call
  295.  *    Pass in (view, 1..n-1, n) during rendering
  296.  *    Pass in (view, n, n) upon completion
  297.  *    
  298.  *    Note: The user must have supplied an idleProgress method with 
  299.  *    Q3XView_SetIdleProgressMethod. Otherwise, the generic idle method is
  300.  *    called with no progress data. e.g. the Q3View_SetIdleMethod method
  301.  *    is called instead. (current and final are ignored, essentially.)
  302.  *
  303.  *    Returns kQ3Failure if rendering is cancelled.
  304.  */
  305. EXTERN_API_C( TQ3Status )
  306. Q3XView_IdleProgress            (TQ3ViewObject             view,
  307.                                  unsigned long             current,
  308.                                  unsigned long             completed);
  309.  
  310. /*
  311.  *    Called by an asynchronous renderer when it completes a frame.
  312.  */
  313. EXTERN_API_C( TQ3Status )
  314. Q3XView_EndFrame                (TQ3ViewObject             view);
  315.  
  316.  
  317. /******************************************************************************
  318.  **                                                                             **
  319.  **                            Renderer AttributeSet Tools                         **
  320.  **                                                                             **
  321.  **                    You may only call these methods from a plug-in             **
  322.  **                                                                             **
  323.  *****************************************************************************/
  324. /*
  325.  *    Faster access to geometry attribute sets.
  326.  *    
  327.  *    Returns pointer to INTERNAL data structure for elements and attributes
  328.  *    in an attributeSet, or NULL if no attribute exists.
  329.  *    
  330.  *    For attributes of type kQ3AttributeType..., the internal data structure
  331.  *    is identical to the data structure used in Q3AttributeSet_Add.
  332.  */
  333. EXTERN_API_C( void *)
  334. Q3XAttributeSet_GetPointer        (TQ3AttributeSet         attributeSet,
  335.                                  TQ3AttributeType         attributeType);
  336.  
  337.  
  338.  
  339. enum {
  340.     kQ3XAttributeMaskNone        = 0L,
  341.     kQ3XAttributeMaskSurfaceUV    = 1 << (kQ3AttributeTypeSurfaceUV - 1),
  342.     kQ3XAttributeMaskShadingUV    = 1 << (kQ3AttributeTypeShadingUV - 1),
  343.     kQ3XAttributeMaskNormal        = 1 << (kQ3AttributeTypeNormal - 1),
  344.     kQ3XAttributeMaskAmbientCoefficient = 1 << (kQ3AttributeTypeAmbientCoefficient - 1),
  345.     kQ3XAttributeMaskDiffuseColor = 1 << (kQ3AttributeTypeDiffuseColor - 1),
  346.     kQ3XAttributeMaskSpecularColor = 1 << (kQ3AttributeTypeSpecularColor - 1),
  347.     kQ3XAttributeMaskSpecularControl = 1 << (kQ3AttributeTypeSpecularControl - 1),
  348.     kQ3XAttributeMaskTransparencyColor = 1 << (kQ3AttributeTypeTransparencyColor - 1),
  349.     kQ3XAttributeMaskSurfaceTangent = 1 << (kQ3AttributeTypeSurfaceTangent - 1),
  350.     kQ3XAttributeMaskHighlightState = 1 << (kQ3AttributeTypeHighlightState - 1),
  351.     kQ3XAttributeMaskSurfaceShader = 1 << (kQ3AttributeTypeSurfaceShader - 1),
  352.     kQ3XAttributeMaskCustomAttribute = (long)0x80000000,
  353.     kQ3XAttributeMaskAll        = (long)0x800007FF,
  354.     kQ3XAttributeMaskInherited    = 0x03FF,
  355.     kQ3XAttributeMaskInterpolated = kQ3XAttributeMaskSurfaceUV | kQ3XAttributeMaskShadingUV | kQ3XAttributeMaskNormal | kQ3XAttributeMaskAmbientCoefficient | kQ3XAttributeMaskDiffuseColor | kQ3XAttributeMaskSpecularColor | kQ3XAttributeMaskSpecularControl | kQ3XAttributeMaskTransparencyColor | kQ3XAttributeMaskSurfaceTangent
  356. };
  357.  
  358.  
  359. typedef unsigned long                     TQ3XAttributeMask;
  360. EXTERN_API_C( TQ3XAttributeMask )
  361. Q3XAttributeSet_GetMask            (TQ3AttributeSet         attributeSet);
  362.  
  363.  
  364. /******************************************************************************
  365.  **                                                                             **
  366.  **                            Renderer Draw Context Tools                         **
  367.  **                                                                             **
  368.  *****************************************************************************/
  369. typedef struct OpaqueTQ3XDrawRegion*     TQ3XDrawRegion;
  370. EXTERN_API_C( TQ3Status )
  371. Q3XDrawContext_GetDrawRegion    (TQ3DrawContextObject     drawContext,
  372.                                  TQ3XDrawRegion *        drawRegion);
  373.  
  374.  
  375. enum TQ3XDrawContextValidationMasks {
  376.     kQ3XDrawContextValidationClearFlags = 0x00000000,
  377.     kQ3XDrawContextValidationDoubleBuffer = 1 << 0,
  378.     kQ3XDrawContextValidationShader = 1 << 1,
  379.     kQ3XDrawContextValidationClearFunction = 1 << 2,
  380.     kQ3XDrawContextValidationActiveBuffer = 1 << 3,
  381.     kQ3XDrawContextValidationInternalOffScreen = 1 << 4,
  382.     kQ3XDrawContextValidationPane = 1 << 5,
  383.     kQ3XDrawContextValidationMask = 1 << 6,
  384.     kQ3XDrawContextValidationDevice = 1 << 7,
  385.     kQ3XDrawContextValidationWindow = 1 << 8,
  386.     kQ3XDrawContextValidationWindowSize = 1 << 9,
  387.     kQ3XDrawContextValidationWindowClip = 1 << 10,
  388.     kQ3XDrawContextValidationWindowPosition = 1 << 11,
  389.     kQ3XDrawContextValidationPlatformAttributes = 1 << 12,
  390.     kQ3XDrawContextValidationForegroundShader = 1 << 13,
  391.     kQ3XDrawContextValidationBackgroundShader = 1 << 14,
  392.     kQ3XDrawContextValidationColorPalette = 1 << 15,
  393.     kQ3XDrawContextValidationAll = (long)0xFFFFFFFF
  394. };
  395. typedef enum TQ3XDrawContextValidationMasks TQ3XDrawContextValidationMasks;
  396.  
  397. typedef unsigned long                     TQ3XDrawContextValidation;
  398. EXTERN_API_C( TQ3Status )
  399. Q3XDrawContext_ClearValidationFlags (TQ3DrawContextObject  drawContext);
  400.  
  401. EXTERN_API_C( TQ3Status )
  402. Q3XDrawContext_GetValidationFlags (TQ3DrawContextObject  drawContext,
  403.                                  TQ3XDrawContextValidation * validationFlags);
  404.  
  405.  
  406. /******************************************************************************
  407.  **                                                                             **
  408.  **                            Renderer Draw Region Tools                         **
  409.  **                                                                             **
  410.  *****************************************************************************/
  411.  
  412. enum TQ3XDevicePixelType {
  413.                                                                 /* These do not indicate byte ordering   */
  414.     kQ3XDevicePixelTypeInvalid    = 0,                            /* Unknown, un-initialized type     */
  415.     kQ3XDevicePixelTypeRGB32    = 1,                            /* Alpha:8 (ignored), R:8, G:8, B:8 */
  416.     kQ3XDevicePixelTypeARGB32    = 2,                            /* Alpha:8, R:8, G:8, B:8              */
  417.     kQ3XDevicePixelTypeRGB24    = 3,                            /* 24 bits/pixel, R:8, G:8, B:8     */
  418.     kQ3XDevicePixelTypeRGB16    = 4,                            /* Alpha:1 (ignored), R:5, G:5, B:5 */
  419.     kQ3XDevicePixelTypeARGB16    = 5,                            /* Alpha:1, R:5, G:5, B:5              */
  420.     kQ3XDevicePixelTypeRGB16_565 = 6,                            /* 16 bits/pixel, R:5, G:6, B:5     */
  421.     kQ3XDevicePixelTypeIndexed8    = 7,                            /* 8-bit color table index             */
  422.     kQ3XDevicePixelTypeIndexed4    = 8,                            /* 4-bit color table index             */
  423.     kQ3XDevicePixelTypeIndexed2    = 9,                            /* 2-bit color table index             */
  424.     kQ3XDevicePixelTypeIndexed1    = 10                            /* 1-bit color table index             */
  425. };
  426. typedef enum TQ3XDevicePixelType TQ3XDevicePixelType;
  427.  
  428.  
  429. enum TQ3XClipMaskState {
  430.     kQ3XClipMaskFullyExposed    = 0,
  431.     kQ3XClipMaskPartiallyExposed = 1,
  432.     kQ3XClipMaskNotExposed        = 2
  433. };
  434. typedef enum TQ3XClipMaskState TQ3XClipMaskState;
  435.  
  436.  
  437. struct TQ3XColorDescriptor {
  438.     unsigned long                     redShift;
  439.     unsigned long                     redMask;
  440.     unsigned long                     greenShift;
  441.     unsigned long                     greenMask;
  442.     unsigned long                     blueShift;
  443.     unsigned long                     blueMask;
  444.     unsigned long                     alphaShift;
  445.     unsigned long                     alphaMask;
  446. };
  447. typedef struct TQ3XColorDescriptor        TQ3XColorDescriptor;
  448.  
  449. struct TQ3XDrawRegionDescriptor {
  450.     unsigned long                     width;
  451.     unsigned long                     height;
  452.     unsigned long                     rowBytes;
  453.     unsigned long                     pixelSize;
  454.     TQ3XDevicePixelType             pixelType;
  455.     TQ3XColorDescriptor             colorDescriptor;
  456.     TQ3Endian                         bitOrder;
  457.     TQ3Endian                         byteOrder;
  458.     TQ3Bitmap *                        clipMask;
  459. };
  460. typedef struct TQ3XDrawRegionDescriptor    TQ3XDrawRegionDescriptor;
  461.  
  462. enum TQ3XDrawRegionServicesMasks {
  463.     kQ3XDrawRegionServicesNoneFlag = 0L,
  464.     kQ3XDrawRegionServicesClearFlag = 1 << 0,
  465.     kQ3XDrawRegionServicesDontLockDDSurfaceFlag = 1 << 1
  466. };
  467. typedef enum TQ3XDrawRegionServicesMasks TQ3XDrawRegionServicesMasks;
  468.  
  469.  
  470. typedef unsigned long                     TQ3XDrawRegionServices;
  471. typedef CALLBACK_API_C( void , TQ3XDrawRegionRendererPrivateDeleteMethod )(void *rendererPrivate);
  472. EXTERN_API_C( TQ3Status )
  473. Q3XDrawRegion_GetDeviceScaleX    (TQ3XDrawRegion         drawRegion,
  474.                                  float *                deviceScaleX);
  475.  
  476. EXTERN_API_C( TQ3Status )
  477. Q3XDrawRegion_GetDeviceScaleY    (TQ3XDrawRegion         drawRegion,
  478.                                  float *                deviceScaleY);
  479.  
  480.  
  481. EXTERN_API_C( TQ3Status )
  482. Q3XDrawRegion_GetDeviceOffsetX    (TQ3XDrawRegion         drawRegion,
  483.                                  float *                deviceOffsetX);
  484.  
  485. EXTERN_API_C( TQ3Status )
  486. Q3XDrawRegion_GetDeviceOffsetY    (TQ3XDrawRegion         drawRegion,
  487.                                  float *                deviceOffsetX);
  488.  
  489.  
  490. EXTERN_API_C( TQ3Status )
  491. Q3XDrawRegion_GetWindowScaleX    (TQ3XDrawRegion         drawRegion,
  492.                                  float *                windowScaleX);
  493.  
  494. EXTERN_API_C( TQ3Status )
  495. Q3XDrawRegion_GetWindowScaleY    (TQ3XDrawRegion         drawRegion,
  496.                                  float *                windowScaleY);
  497.  
  498.  
  499. EXTERN_API_C( TQ3Status )
  500. Q3XDrawRegion_GetWindowOffsetX    (TQ3XDrawRegion         drawRegion,
  501.                                  float *                windowOffsetX);
  502.  
  503. EXTERN_API_C( TQ3Status )
  504. Q3XDrawRegion_GetWindowOffsetY    (TQ3XDrawRegion         drawRegion,
  505.                                  float *                windowOffsetY);
  506.  
  507. EXTERN_API_C( TQ3Status )
  508. Q3XDrawRegion_IsActive            (TQ3XDrawRegion         drawRegion,
  509.                                  TQ3Boolean *            isActive);
  510.  
  511.  
  512. EXTERN_API_C( TQ3Status )
  513. Q3XDrawRegion_GetNextRegion        (TQ3XDrawRegion         drawRegion,
  514.                                  TQ3XDrawRegion *        nextDrawRegion);
  515.  
  516. /* 
  517.  *  One of the next two functions must be called before using a draw region 
  518.  */
  519. /*
  520.  *    Use this Start function if double buffering/image access services from the
  521.  *    Draw Context are not needed, you may still request clear for example
  522.  */
  523. EXTERN_API_C( TQ3Status )
  524. Q3XDrawRegion_Start                (TQ3XDrawRegion         drawRegion,
  525.                                  TQ3XDrawRegionServices  services,
  526.                                  TQ3XDrawRegionDescriptor ** descriptor);
  527.  
  528. /*
  529.  *    Use this Start function if double buffering or image access services from 
  530.  *  the Draw Context are needed.
  531.  */
  532. EXTERN_API_C( TQ3Status )
  533. Q3XDrawRegion_StartAccessToImageBuffer (TQ3XDrawRegion     drawRegion,
  534.                                  TQ3XDrawRegionServices  services,
  535.                                  TQ3XDrawRegionDescriptor ** descriptor,
  536.                                  void **                image);
  537.  
  538. /*
  539.  *    This function is used to indicate that access to a DrawRegion is ended.
  540.  */
  541. EXTERN_API_C( TQ3Status )
  542. Q3XDrawRegion_End                (TQ3XDrawRegion         drawRegion);
  543.  
  544. EXTERN_API_C( TQ3Status )
  545. Q3XDrawRegion_GetDeviceTransform (TQ3XDrawRegion         drawRegion,
  546.                                  TQ3Matrix4x4 **        deviceTransform);
  547.  
  548. EXTERN_API_C( TQ3Status )
  549. Q3XDrawRegion_GetClipFlags        (TQ3XDrawRegion         drawRegion,
  550.                                  TQ3XClipMaskState *    clipMaskState);
  551.  
  552. EXTERN_API_C( TQ3Status )
  553. Q3XDrawRegion_GetClipMask        (TQ3XDrawRegion         drawRegion,
  554.                                  TQ3Bitmap **            clipMask);
  555.  
  556. #if TARGET_OS_MAC
  557. EXTERN_API_C( TQ3Status )
  558. Q3XDrawRegion_GetClipRegion        (TQ3XDrawRegion         drawRegion,
  559.                                  RgnHandle *            rgnHandle);
  560.  
  561. EXTERN_API_C( TQ3Status )
  562. Q3XDrawRegion_GetGDHandle        (TQ3XDrawRegion         drawRegion,
  563.                                  GDHandle *                gdHandle);
  564.  
  565. #endif  /* TARGET_OS_MAC */
  566.  
  567. EXTERN_API_C( TQ3Status )
  568. Q3XDrawRegion_GetRendererPrivate (TQ3XDrawRegion         drawRegion,
  569.                                  void **                rendererPrivate);
  570.  
  571. EXTERN_API_C( TQ3Status )
  572. Q3XDrawRegion_SetRendererPrivate (TQ3XDrawRegion         drawRegion,
  573.                                  const void *            rendererPrivate,
  574.                                  TQ3XDrawRegionRendererPrivateDeleteMethod  deleteMethod);
  575.  
  576. EXTERN_API_C( TQ3Status )
  577. Q3XDrawRegion_SetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  578.                                  TQ3Boolean             flag);
  579.  
  580. EXTERN_API_C( TQ3Status )
  581. Q3XDrawRegion_GetUseDefaultRendererFlag (TQ3XDrawRegion  drawRegion,
  582.                                  TQ3Boolean *            useDefaultRenderingFlag);
  583.  
  584.  
  585.  
  586. /******************************************************************************
  587.  **                                                                             **
  588.  **                            Renderer Class Methods                             **
  589.  **                                                                             **
  590.  *****************************************************************************/
  591. /*
  592.  *    Methods from Object
  593.  *        kQ3XMethodTypeObjectClassRegister
  594.  *        kQ3XMethodTypeObjectClassUnregister
  595.  *        kQ3XMethodTypeObjectNew
  596.  *        kQ3XMethodTypeObjectDelete
  597.  *        kQ3XMethodTypeObjectRead
  598.  *        kQ3XMethodTypeObjectTraverse
  599.  *        kQ3XMethodTypeObjectWrite
  600.  *        
  601.  *    Methods from Shared
  602.  *        kQ3MethodTypeSharedEdited
  603.  *
  604.  *    Renderer Methods
  605.  *    
  606.  *    The renderer methods should be implemented according to the type
  607.  *    of renderer being written.
  608.  *
  609.  *    For the purposes of documentation, there are two basic types of
  610.  *    renderers: 
  611.  *
  612.  *        Interactive
  613.  *            Interactive Renderer
  614.  *            WireFrame Renderer
  615.  *        
  616.  *        Deferred
  617.  *            a ray-tracer
  618.  *            painter's algorithm renderer (cached in a BSP triangle tree)
  619.  *            an artistic renderer (simulates a pencil drawing, etc.)
  620.  *
  621.  *    The main difference is how each renderer handles incoming state and 
  622.  *    geometry.
  623.  *
  624.  *    An interactive renderer immediately transforms, culls, and shades
  625.  *    incoming geometry and performs rasterization. For example, in a 
  626.  *    single-buffered WireFrame renderer, you will see a new triangle
  627.  *    immediately after Q3Triangle_Draw (if it's visible, of course).
  628.  *
  629.  *    A deferred renderer caches the view state and each geometry, 
  630.  *    converting into any internal queue of drawing commands. Rasterization
  631.  *    is not actually performed until all data has been submitted.
  632.  *    
  633.  *    For example, a ray-tracer may not rasterize anything until the
  634.  *    end of the rendering loop, or until an EndFrame call is made.
  635.  */
  636.  
  637. /******************************************************************************
  638.  **                                                                             **
  639.  **                        Renderer User Interface Methods                         **
  640.  **                                                                             **
  641.  *****************************************************************************/
  642. /*
  643.  *    kQ3XMethodTypeRendererIsInteractive
  644.  *    
  645.  *    There is no actual method with this - the metahandler simply returns
  646.  *  "(TQ3XFunctionPointer)kQ3True" for this "method" if the renderer is 
  647.  *  intended to be used in interactive settings, and   
  648.  *    "(TQ3XFunctionPointer)kQ3False" otherwise. 
  649.  *  
  650.  *  If neither value is specified in the metahandler, the renderer 
  651.  *  is *assumed to be non-interactive*!!!
  652.  *    
  653.  *    OPTIONAL
  654.  */
  655.  
  656. enum {
  657.     kQ3XMethodTypeRendererIsInteractive = FOUR_CHAR_CODE('isin')
  658. };
  659.  
  660.  
  661. /*
  662.  *    TQ3XRendererModalConfigureMethod
  663.  *    
  664.  *    This method should pop up a modal dialog to edit the renderer settings 
  665.  *    found in the renderer private. 
  666.  *    
  667.  *    dialogAnchor - is platform specific data passed by the client to support
  668.  *      movable modal dialogs. 
  669.  *    MacOS: this is a callback to the calling application's event handler.
  670.  *      The renderer calls this function with events not handled by the 
  671.  *      settings dialog. This is necessary in order to support movable modal 
  672.  *      dialogs. An application's event handler must return kQ3True if it 
  673.  *      handles the event passed to the callback or kQ3False if not. 
  674.  *      An application which doesn't want to support a movable modal configure
  675.  *      dialog should pass NULL for the clientEventHandler of TQ3DialogAnchor.
  676.  *      A renderer should implement a non-movable style dialog in that case.
  677.  *    Win32: this is the HWND of the owning window (typically an application's
  678.  *      main window).  (Win32 application modal dialogs are always movable.)
  679.  *  canceled - returns a boolean inditacating that the user canceled the 
  680.  *    dialog.
  681.  *    
  682.  *    OPTIONAL
  683.  */
  684.  
  685. enum {
  686.     kQ3XMethodTypeRendererModalConfigure = FOUR_CHAR_CODE('rdmc')
  687. };
  688.  
  689. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererModalConfigureMethod )(TQ3RendererObject renderer, TQ3DialogAnchor dialogAnchor, TQ3Boolean *canceled, void *rendererPrivate);
  690. /*
  691.  *    kQ3XMethodTypeRendererGetNickNameString
  692.  *    
  693.  *        Allows an application to collect the name of the renderer for
  694.  *        display in a user interface item such as a menu.
  695.  *    
  696.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  697.  *        bytes of a data buffer large enough to store the renderer name. 
  698.  *
  699.  *      bufferSize is the actual size of the memory block pointed to by 
  700.  *        dataBuffer
  701.  *
  702.  *        actualDataSize - on return the actual number of bytes written to the
  703.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  704.  *
  705.  *    OPTIONAL
  706.  */
  707.  
  708. enum {
  709.     kQ3XMethodTypeRendererGetNickNameString = FOUR_CHAR_CODE('rdns')
  710. };
  711.  
  712. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetNickNameStringMethod )(unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize);
  713. /*
  714.  *    kQ3XMethodTypeRendererGetConfigurationData
  715.  *    
  716.  *        Allows an application to collect private configuration data from the
  717.  *      renderer which it will then save. For example in a preference file, 
  718.  *      a registry key (on Windows) or in a style template. An application 
  719.  *      should tag this data with the renderer's object name.
  720.  *    
  721.  *        If dataBuffer is NULL actualDataSize returns the required size in 
  722.  *        bytes of a data buffer large enough to store private data. 
  723.  *
  724.  *      bufferSize is the actual size of the memory block pointed to by 
  725.  *        dataBuffer
  726.  *
  727.  *        actualDataSize - on return the actual number of bytes written to the
  728.  *        buffer or if dataBuffer is NULL the required size of dataBuffer
  729.  *
  730.  *    OPTIONAL
  731.  */
  732.  
  733. enum {
  734.     kQ3XMethodTypeRendererGetConfigurationData = FOUR_CHAR_CODE('rdgp')
  735. };
  736.  
  737. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererGetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, unsigned long *actualDataSize, void *rendererPrivate);
  738. /*
  739.  *    TQ3XRendererSetConfigurationDataMethod
  740.  *    
  741.  *        Allows an application to pass private configuration data which has
  742.  *         previously  been obtained from a renderer via 
  743.  *        Q3Renderer_GetConfigurationData. For example in a preference file or 
  744.  *        in a style template. An application should tag this data with the 
  745.  *        renderer's object name.
  746.  *    
  747.  *      bufferSize is the actual size of the memory block pointed to by 
  748.  *        dataBuffer
  749.  *
  750.  *    OPTIONAL
  751.  */
  752.  
  753. enum {
  754.     kQ3XMethodTypeRendererSetConfigurationData = FOUR_CHAR_CODE('rdsp')
  755. };
  756.  
  757. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSetConfigurationDataMethod )(TQ3RendererObject renderer, unsigned char *dataBuffer, unsigned long bufferSize, void *rendererPrivate);
  758. /******************************************************************************
  759.  **                                                                             **
  760.  **                        Renderer Drawing State Methods                         **
  761.  **                                                                             **
  762.  *****************************************************************************/
  763. /*
  764.  *    TQ3RendererStartFrame
  765.  *    
  766.  *    The StartFrame method is called first at Q3View_StartRendering
  767.  *    and should:
  768.  *        - initialize any renderer state to defaults
  769.  *        - extract any and all useful data from the drawContext
  770.  *
  771.  *    If your renderer passed in kQ3RendererFlagClearBuffer at 
  772.  *    registration, then it should also:
  773.  *        - clear the drawContext 
  774.  *    
  775.  *        When clearing, your renderer may opt to:
  776.  *        - NOT clear anything (if you touch every pixel, for example)
  777.  *        - to clear with your own routine, or
  778.  *        - to use the draw context default clear method by calling 
  779.  *        Q3DrawContext_Clear. Q3DrawContext_Clear takes advantage of
  780.  *        any available hardware in the system for clearing.
  781.  *    
  782.  *    This call also signals the start of all default submit commands from
  783.  *    the view. The renderer will receive updates for the default view
  784.  *    state via its Update methods before StartPass is called.
  785.  *    
  786.  *    REQUIRED
  787.  */
  788.  
  789. enum {
  790.     kQ3XMethodTypeRendererStartFrame = FOUR_CHAR_CODE('rdcl')
  791. };
  792.  
  793. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  794. /*
  795.  *    kQ3XMethodTypeRendererStartPass
  796.  *    TQ3XRendererStartPassMethod
  797.  *    
  798.  *    The StartPass method is called during Q3View_StartRendering but after
  799.  *    the StartFrame command. It should:
  800.  *        - collect camera and light information
  801.  *    
  802.  *    If your renderer supports deferred camera transformation, camera is the
  803.  *    main camera which will be submitted in the hierarchy somewhere. It
  804.  *    is never NULL.
  805.  *
  806.  *    If your renderer does not support deferred camera transformation, camera
  807.  *    is the transformed camera.
  808.  *
  809.  *    If your renderer supports deferred light transformation, lights will be
  810.  *    NULL, and will be submitted to your light draw methods instead.
  811.  *
  812.  *    This call signals the end of the default update state, and the start of 
  813.  *  submit commands from the user to the view.
  814.  *
  815.  *    REQUIRED
  816.  */
  817.  
  818. enum {
  819.     kQ3XMethodTypeRendererStartPass = FOUR_CHAR_CODE('rdst')
  820. };
  821.  
  822. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererStartPassMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, TQ3GroupObject lightGroup);
  823. /*
  824.  *    kQ3XMethodTypeRendererFlushFrame
  825.  *    TQ3XRendererFlushFrameMethod
  826.  *    
  827.  *    This call is only implemented by asynchronous renderers.
  828.  *    
  829.  *    The FlushFrame method is called between the StartPass and EndPass
  830.  *    methods and is called when the user wishes to flush any asynchronous
  831.  *    drawing tasks (which draw to the drawcontext), but does not want 
  832.  *    to block.
  833.  *    
  834.  *    The result of this call is that an image should "eventually" appear
  835.  *    asynchronously.
  836.  *    
  837.  *    For asynchronous rendering, this call is non-blocking.
  838.  *    
  839.  *    An interactive renderer should ensure that all received
  840.  *    geometries are drawn in the image.
  841.  *    
  842.  *    An interactive renderer that talks to hardware should force
  843.  *    the hardware to generate an image.
  844.  *    
  845.  *    A deferred renderer should exhibit a similar behaviour,
  846.  *    though it is not required.  A deferred renderer should spawn
  847.  *    a process that generates a partial image from the currently
  848.  *    accumulated drawing state. 
  849.  *    
  850.  *    However, for renderers such as ray-tracers which generally are
  851.  *    quite compute-intensive, FlushFrame is not required and is a no-op.
  852.  *
  853.  *    OPTIONAL
  854.  */
  855.  
  856. enum {
  857.     kQ3XMethodTypeRendererFlushFrame = FOUR_CHAR_CODE('rdfl')
  858. };
  859.  
  860. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererFlushFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  861. /*
  862.  *    kQ3XMethodTypeRendererEndPass
  863.  *    TQ3XRendererEndPassMethod
  864.  *    
  865.  *    The EndPass method is called at Q3View_EndRendering and signals
  866.  *    the end of submit commands to the view.
  867.  *
  868.  *    If an error occurs, the renderer should call Q3XError_Post and
  869.  *    return kQ3ViewStatusError.
  870.  *    
  871.  *    If a renderer requires another pass on the renderering data,
  872.  *    it should return kQ3ViewStatusRetraverse.
  873.  *    
  874.  *    If rendering was cancelled, this function will not be called
  875.  *    and the view will handle returning kQ3ViewStatusCancelled;
  876.  *    
  877.  *    Otherwise, your renderer should begin completing the process of 
  878.  *    generating the image in the drawcontext. If you have buffered
  879.  *    any drawing data, flush it. RendererEnd should have a similar
  880.  *    effect as RendererFlushFrame.
  881.  *    
  882.  *    If the renderer is synchronous:
  883.  *        - complete rendering of the entire frame
  884.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer
  885.  *            - Update the front buffer
  886.  *        else
  887.  *            - DrawContext will update the front buffer after returning
  888.  *
  889.  *    If the renderer is asynchronous
  890.  *        - spawn rendering thread for entire frame
  891.  *        if the renderer supports kQ3RendererClassSupportDoubleBuffer,
  892.  *            - you must eventually update the front buffer asynchronously
  893.  *        else
  894.  *            - you must eventually update the back buffer asynchronously
  895.  *            
  896.  *    REQUIRED
  897.  */
  898.  
  899. enum {
  900.     kQ3XMethodTypeRendererEndPass = FOUR_CHAR_CODE('rded')
  901. };
  902.  
  903. typedef CALLBACK_API_C( TQ3ViewStatus , TQ3XRendererEndPassMethod )(TQ3ViewObject view, void *rendererPrivate);
  904. /*
  905.  *    kQ3XMethodTypeRendererEndFrame
  906.  *    TQ3XRendererEndFrame
  907.  *    
  908.  *    This call is only implemented by asynchronous renderers.
  909.  *
  910.  *    The EndFrame method is called from Q3View_Sync, which is
  911.  *    called after Q3View_EndRendering and signals that the user
  912.  *    wishes to see the completed image and is willing to block.
  913.  *    
  914.  *    If your renderer supports kQ3RendererFlagDoubleBuffer
  915.  *        - update the front buffer completely 
  916.  *    else
  917.  *        - update the back buffer completely
  918.  *
  919.  *    This call is equivalent in functionality to RendererFlushFrame
  920.  *    but blocks until the image is completed.
  921.  *    
  922.  *    If no method is supplied, the default is a no-op.
  923.  *    
  924.  *    NOTE: Registering a method of this type indicates that your renderer will
  925.  *    be rendering after Q3View_EndRendering has been called.
  926.  *    
  927.  *    OPTIONAL
  928.  */
  929.  
  930. enum {
  931.     kQ3XMethodTypeRendererEndFrame = FOUR_CHAR_CODE('rdsy')
  932. };
  933.  
  934. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererEndFrameMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3DrawContextObject drawContext);
  935. /*
  936.  *    The RendererCancel method is called after Q3View_StartRendering
  937.  *    and signals the termination of all rendering operations.
  938.  *
  939.  *    A renderer should clean up any cached data, and cancel all 
  940.  *    rendering operations.
  941.  *    
  942.  *    If called before Q3View_EndRendering, the RendererEnd method
  943.  *    is NOT called.
  944.  *    
  945.  *    If called after Q3View_EndRendering, the renderer should kill
  946.  *    any threads and terminate any further rendering.
  947.  *    
  948.  *    REQUIRED
  949.  */
  950.  
  951. enum {
  952.     kQ3XMethodTypeRendererCancel = FOUR_CHAR_CODE('rdab')
  953. };
  954.  
  955. typedef CALLBACK_API_C( void , TQ3XRendererCancelMethod )(TQ3ViewObject view, void *rendererPrivate);
  956. /******************************************************************************
  957.  **                                                                             **
  958.  **                        Renderer DrawContext Methods                         **
  959.  **                                                                             **
  960.  *****************************************************************************/
  961. /*
  962.  *    kQ3XMethodTypeRendererPush
  963.  *    TQ3XRendererPushMethod
  964.  *    
  965.  *    kQ3XMethodTypeRendererPop
  966.  *    TQ3XRendererPopMethod
  967.  *    
  968.  *    These methods are called whenever the graphics state in the view
  969.  *    is pushed or popped. The user may isolate state by calling:
  970.  *    
  971.  *    Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &red, view);
  972.  *    Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &blue, view);
  973.  *    Q3Attribute_Submit(kQ3AttributeTypeSpecularColor, &white, view);
  974.  *    Q3Box_Submit(&unitBox, view);
  975.  *    Q3TranslateTransform_Submit(&unitVector, view);
  976.  *    Q3Push_Submit(view);
  977.  *        Q3Attribute_Submit(kQ3AttributeTypeDiffuseColor, &blue, view);
  978.  *        Q3Attribute_Submit(kQ3AttributeTypeTransparencyColor, &green, view);
  979.  *        Q3Box_Submit(&unitBox, view);
  980.  *    Q3Pop_Submit(view);    
  981.  *    Q3TranslateTransform_Submit(&unitVector, view);
  982.  *    Q3Box_Submit(&unitBox, view);
  983.  *    
  984.  *    or by submitting a display group which pushes and pops.
  985.  *    
  986.  *    If you support RendererPush and RendererPop in your renderer:
  987.  *        - you must maintain your drawing state as a stack, as well.
  988.  *        - you will not be updated with the popped state after
  989.  *            RendererPop is called.
  990.  *
  991.  *    If you do not support Push and Pop in your renderer:
  992.  *        - you may maintain a single copy of the drawing state.
  993.  *        - you will be updated with changed fields after the view stack is
  994.  *            popped.
  995.  *
  996.  *    A renderer that supports Push and Pop gets called in the following
  997.  *    sequence (from example above):
  998.  *    
  999.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1000.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1001.  *    RendererUpdateAttributeSpecularColor(&white,...)
  1002.  *    RendererUpdateMatrixLocalToWorld(...)
  1003.  *    RendererSubmitGeometryBox(...)
  1004.  *    RendererPush(...)
  1005.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  1006.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  1007.  *        RendererSubmitGeometryBox(...)
  1008.  *    RendererPop(...)
  1009.  *    RendererUpdateMatrixLocalToWorld(...)
  1010.  *    RendererSubmitGeometryBox(...)
  1011.  *
  1012.  *    A renderer that does not supports Push and Pop gets called in the
  1013.  *    following sequence:
  1014.  *    
  1015.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1016.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1017.  *    RendererUpdateAttributeSpecularColor(&white,...)
  1018.  *    RendererUpdateMatrixLocalToWorld(...)
  1019.  *    RendererSubmitGeometryBox(...)
  1020.  *        RendererUpdateAttributeDiffuseColor(&blue,...)
  1021.  *        RendererUpdateAttributeTransparencyColor(&green,...)
  1022.  *        RendererSubmitGeometryBox(...)
  1023.  *    RendererUpdateAttributeDiffuseColor(&red,...)
  1024.  *    RendererUpdateAttributeTransparencyColor(&blue,...)
  1025.  *    RendererUpdateMatrixLocalToWorld(...)
  1026.  *    RendererSubmitGeometryBox(...)
  1027.  *    
  1028.  */
  1029.  
  1030. enum {
  1031.     kQ3XMethodTypeRendererPush    = FOUR_CHAR_CODE('rdps')
  1032. };
  1033.  
  1034. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPushMethod )(TQ3ViewObject view, void *rendererPrivate);
  1035.  
  1036. enum {
  1037.     kQ3XMethodTypeRendererPop    = FOUR_CHAR_CODE('rdpo')
  1038. };
  1039.  
  1040. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererPopMethod )(TQ3ViewObject view, void *rendererPrivate);
  1041. /******************************************************************************
  1042.  **                                                                             **
  1043.  **                            Renderer Cull Methods                             **
  1044.  **                                                                             **
  1045.  *****************************************************************************/
  1046. /*
  1047.  *    kQ3XMethodTypeRendererIsBoundingBoxVisible
  1048.  *    TQ3XRendererIsBoundingBoxVisibleMethod
  1049.  *    
  1050.  *    This method is called to cull complex groups and geometries 
  1051.  *    given their bounding box in local space.
  1052.  *    
  1053.  *    It should transform the local-space bounding box coordinates to
  1054.  *    frustum space and return a TQ3Boolean return value indicating
  1055.  *    whether the box appears within the viewing frustum.
  1056.  *    
  1057.  *    If no method is supplied, the default behavior is to return
  1058.  *    kQ3True.
  1059.  *    
  1060.  */
  1061.  
  1062. enum {
  1063.     kQ3XMethodTypeRendererIsBoundingBoxVisible = FOUR_CHAR_CODE('rdbx')
  1064. };
  1065.  
  1066. typedef CALLBACK_API_C( TQ3Boolean , TQ3XRendererIsBoundingBoxVisibleMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3BoundingBox *bBox);
  1067.  
  1068. /******************************************************************************
  1069.  **                                                                             **
  1070.  **                        Renderer Object Support Methods                         **
  1071.  **                                                                             **
  1072.  *****************************************************************************/
  1073. /*
  1074.  *    Drawing methods (Geometry, Camera, Lights)
  1075.  *
  1076.  */
  1077. /*
  1078.  *    Geometry MetaHandler
  1079.  *    
  1080.  *    This metaHandler is required to support 
  1081.  *    
  1082.  *    kQ3GeometryTypeTriangle
  1083.  *    kQ3GeometryTypeLine
  1084.  *    kQ3GeometryTypePoint
  1085.  *    kQ3GeometryTypeMarker
  1086.  *    kQ3GeometryTypePixmapMarker
  1087.  *    
  1088.  *    REQUIRED
  1089.  */
  1090.  
  1091. enum {
  1092.     kQ3XMethodTypeRendererSubmitGeometryMetaHandler = FOUR_CHAR_CODE('rdgm')
  1093. };
  1094.  
  1095. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitGeometryMetaHandlerMethod )(TQ3ObjectType geometryType);
  1096. /*
  1097.  *    The TQ3XRendererSubmitGeometryMetaHandlerMethod switches on geometryType
  1098.  *    of kQ3GeometryTypeFoo and returns methods of type:
  1099.  */
  1100. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitGeometryMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3GeometryObject geometry, const void *publicData);
  1101. /*
  1102.  *    Camera MetaHandler
  1103.  *    
  1104.  *    This metaHandler, if supplied, indicates that your renderer
  1105.  *    handles deferred transformation of the main camera within a scene.
  1106.  *    
  1107.  *    If not supplied, or an unsupported camera is used, the view will do
  1108.  *    the transformation for the renderer and pass in a camera in the 
  1109.  *    StartPass method.
  1110.  *    
  1111.  *    OPTIONAL
  1112.  */
  1113.  
  1114. enum {
  1115.     kQ3XMethodTypeRendererSubmitCameraMetaHandler = FOUR_CHAR_CODE('rdcm')
  1116. };
  1117.  
  1118. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitCameraMetaHandlerMethod )(TQ3ObjectType cameraType);
  1119. /*
  1120.  *    The TQ3XRendererSubmitCameraMetaHandlerMethod switches on cameraType
  1121.  *    of kQ3CameraTypeFoo and returns methods of type:
  1122.  */
  1123. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitCameraMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3CameraObject camera, const void *publicData);
  1124. /*
  1125.  *    Light MetaHandler
  1126.  *    
  1127.  *    This metaHandler, if supplied, indicates that your renderer
  1128.  *    handles deferred transformation of lights within a scene.
  1129.  *    
  1130.  *    If an unsupported light is encountered, it is ignored.
  1131.  *
  1132.  *    OPTIONAL
  1133.  */
  1134.  
  1135. enum {
  1136.     kQ3XMethodTypeRendererSubmitLightMetaHandler = FOUR_CHAR_CODE('rdlg')
  1137. };
  1138.  
  1139. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererSubmitLightMetaHandlerMethod )(TQ3ObjectType lightType);
  1140. /*
  1141.  *    The TQ3XRendererSubmitLightMetaHandlerMethod switches on lightType
  1142.  *    of kQ3LightTypeFoo and returns methods of type:
  1143.  */
  1144. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererSubmitLightMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3LightObject light, const void *publicData);
  1145. /*
  1146.  *
  1147.  *    Update methods
  1148.  *
  1149.  *    They are called whenever the state has changed. If the renderer supports
  1150.  *    the RendererPush and RendererPop methods, it must maintain its own state
  1151.  *    stack. Updates are not called for changed data when the view stack is
  1152.  *    popped.
  1153.  *
  1154.  *    See the comments for the RendererPush and RendererPop methods above
  1155.  *    for an example of how data is updated.
  1156.  *
  1157.  */
  1158. /*
  1159.  *    Style
  1160.  */
  1161.  
  1162. enum {
  1163.     kQ3XMethodTypeRendererUpdateStyleMetaHandler = FOUR_CHAR_CODE('rdyu')
  1164. };
  1165.  
  1166. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateStyleMetaHandlerMethod )(TQ3ObjectType styleType);
  1167. /*
  1168.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on styleType
  1169.  *    of kQ3StyleTypeFoo and returns methods of type:
  1170.  */
  1171. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateStyleMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1172. /*
  1173.  *    Attributes
  1174.  */
  1175.  
  1176. enum {
  1177.     kQ3XMethodTypeRendererUpdateAttributeMetaHandler = FOUR_CHAR_CODE('rdau')
  1178. };
  1179.  
  1180. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateAttributeMetaHandlerMethod )(TQ3AttributeType attributeType);
  1181. /*
  1182.  *    The TQ3XRendererUpdateStyleMetaHandlerMethod switches on attributeType
  1183.  *    of kQ3AttributeTypeFoo and returns methods of type:
  1184.  */
  1185. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateAttributeMethod )(TQ3ViewObject view, void *rendererPrivate, const void *publicData);
  1186. /*
  1187.  *    Shaders
  1188.  */
  1189.  
  1190. enum {
  1191.     kQ3XMethodTypeRendererUpdateShaderMetaHandler = FOUR_CHAR_CODE('rdsu')
  1192. };
  1193.  
  1194. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XRendererUpdateShaderMetaHandlerMethod )(TQ3ObjectType shaderType);
  1195. /*
  1196.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on shaderType
  1197.  *    of kQ3ShaderTypeFoo and returns methods of type:
  1198.  */
  1199. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateShaderMethod )(TQ3ViewObject view, void *rendererPrivate, TQ3Object shaderObject);
  1200. /*
  1201.  *    Matrices
  1202.  */
  1203.  
  1204. enum {
  1205.     kQ3XMethodTypeRendererUpdateMatrixMetaHandler = FOUR_CHAR_CODE('rdxu')
  1206. };
  1207.  
  1208. typedef TQ3XMetaHandler                 TQ3XRendererUpdateMatrixMetaHandlerMethod;
  1209. /*
  1210.  *    The TQ3XRendererUpdateShaderMetaHandlerMethod switches on methods
  1211.  *    of the form kQ3MethodTypeRendererUpdateMatrixFoo:
  1212.  */
  1213.  
  1214. enum {
  1215.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorld = FOUR_CHAR_CODE('ulwx')
  1216. };
  1217.  
  1218.  
  1219. enum {
  1220.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverse = FOUR_CHAR_CODE('ulwi')
  1221. };
  1222.  
  1223.  
  1224. enum {
  1225.     kQ3XMethodTypeRendererUpdateMatrixLocalToWorldInverseTranspose = FOUR_CHAR_CODE('ulwt')
  1226. };
  1227.  
  1228.  
  1229. enum {
  1230.     kQ3XMethodTypeRendererUpdateMatrixLocalToCamera = FOUR_CHAR_CODE('ulcx')
  1231. };
  1232.  
  1233.  
  1234. enum {
  1235.     kQ3XMethodTypeRendererUpdateMatrixLocalToFrustum = FOUR_CHAR_CODE('ulfx')
  1236. };
  1237.  
  1238.  
  1239. enum {
  1240.     kQ3XMethodTypeRendererUpdateMatrixWorldToFrustum = FOUR_CHAR_CODE('uwfx')
  1241. };
  1242.  
  1243. /*
  1244.  *    and returns methods of type:
  1245.  */
  1246. typedef CALLBACK_API_C( TQ3Status , TQ3XRendererUpdateMatrixMethod )(TQ3ViewObject view, void *rendererPrivate, const TQ3Matrix4x4 *matrix);
  1247.  
  1248.  
  1249. #if PRAGMA_ENUM_ALWAYSINT
  1250.     #pragma enumsalwaysint reset
  1251. #elif PRAGMA_ENUM_OPTIONS
  1252.     #pragma option enum=reset
  1253. #elif defined(PRAGMA_ENUM_PACK__QD3DRENDERER__)
  1254.     #pragma options(pack_enums)
  1255. #endif
  1256.  
  1257. #if PRAGMA_STRUCT_ALIGN
  1258.     #pragma options align=reset
  1259. #elif PRAGMA_STRUCT_PACKPUSH
  1260.     #pragma pack(pop)
  1261. #elif PRAGMA_STRUCT_PACK
  1262.     #pragma pack()
  1263. #endif
  1264.  
  1265. #ifdef PRAGMA_IMPORT_OFF
  1266. #pragma import off
  1267. #elif PRAGMA_IMPORT
  1268. #pragma import reset
  1269. #endif
  1270.  
  1271. #ifdef __cplusplus
  1272. }
  1273. #endif
  1274.  
  1275. #endif /* __QD3DRENDERER__ */
  1276.  
  1277.